package com.github.aloxc.plugin.restplus.swagger;

import com.github.aloxc.plugin.restplus.entity.EnvironmentConfig;
import com.github.aloxc.plugin.restplus.entity.SwaggerConfig;
import com.github.aloxc.plugin.restplus.utils.StringUtils;
import com.intellij.openapi.project.Project;

import java.util.HashMap;

public interface SwaggerAdapter {
    SwaggerConfig getApiInfo(HashMap json);
    EnvironmentConfig getEnvironmentConfig(HashMap json);
    static SwaggerAdapter getInstance(String version, Project project){
        if(StringUtils.isNullOrEmpty(version)) {
            return null;
        }
        if(version.contains("2.0")){
            return new Swagger2(project);
        }
        if(version.contains("3.0")){
            return new Swagger2(project);
        }
        return null;
    }
}
